package com.baidu.erp.domain;

import com.baidu.erp.composite.PermissionNode;
import com.baidu.erp.utils.BeanCopierUtil;

public class Permission {
    //DOTO 父权限下的子权限没有设计
    private String id;
    private String code;
    private String name;
    private String moduleUrl;
    private String operationUrl;
    private Integer orderNo;
    private String pId;
    private String createTime;
    private String editTime;

    public Permission() {
    }

    public Permission(String id, String code, String name, String moduleUrl, String operationUrl, Integer orderNo, String pId, String createTime, String editTime) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.moduleUrl = moduleUrl;
        this.operationUrl = operationUrl;
        this.orderNo = orderNo;
        this.pId = pId;
        this.createTime = createTime;
        this.editTime = editTime;
    }

    @Override
    public String toString() {
        return "Permission{" +
                "id='" + id + '\'' +
                ", code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", moduleUrl='" + moduleUrl + '\'' +
                ", operationUrl='" + operationUrl + '\'' +
                ", orderNo=" + orderNo +
                ", pId='" + pId + '\'' +
                ", createTime='" + createTime + '\'' +
                ", editTime='" + editTime + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getModuleUrl() {
        return moduleUrl;
    }

    public void setModuleUrl(String moduleUrl) {
        this.moduleUrl = moduleUrl;
    }

    public String getOperationUrl() {
        return operationUrl;
    }

    public void setOperationUrl(String operationUrl) {
        this.operationUrl = operationUrl;
    }

    public Integer getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(Integer orderNo) {
        this.orderNo = orderNo;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getEditTime() {
        return editTime;
    }

    public void setEditTime(String editTime) {
        this.editTime = editTime;
    }

    /**
     * 把数据类型克隆成指定的类型
     */
    public <T> T clone(Class<T> clazz) {
        T target = null;
        try {
            target = clazz.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        BeanCopierUtil.copy(this,target);
        return target;
    }
}
